package com.zmn.plat.services.impl.channel;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zmn.common.utils.date.DateUtil;
import com.zmn.plat.model.entity.channel.ChannelSettle;
import com.zmn.plat.model.entity.channel.ChannelSettleQuery;
import com.zmn.plat.model.entity.channel.ChannelSettleVO;
import com.zmn.plat.persistence.interfaces.channel.ChannelSettleDAO;
import com.zmn.plat.services.interfaces.channel.ChannelSettleService;

/**
 * 描述:渠道区域ServiceImpl
 *
 * @author tanghongjun
 * @since: 2018/10/16 17:56
 */
@Service
public class ChannelSettleServiceImpl implements ChannelSettleService {

    @Resource
    private ChannelSettleDAO channelSettleDAO;

    @Override
    public ChannelSettle findByKey(Integer relateId) {
        return channelSettleDAO.findByKey(relateId);
    }

    @Override
    public Integer findKeyForMax() {
        return channelSettleDAO.findKeyForMax();
    }

    @Override
    public List<ChannelSettle> listPageByQuery(ChannelSettleQuery query) {
        return channelSettleDAO.listPageByQuery(query);
    }

    @Override
    public List<ChannelSettleVO> listByQuery(ChannelSettleQuery query) {
        return channelSettleDAO.listByQuery(query);
    }

    @Override
    public List<ChannelSettle> listAll() {
        return channelSettleDAO.listAll();
    }

    @Override
    public List<ChannelSettle> listWithLevelTwo() {
        return channelSettleDAO.listWithLevelTwo();
    }

    @Override
    public List<ChannelSettle> listByNotCps() {
        return channelSettleDAO.listByNotCps();
    }

    @Override
    public Integer countByQuery(ChannelSettleQuery query) {
        return channelSettleDAO.countByQuery(query);
    }

    @Override
    public Integer updateByKey(ChannelSettle channelSettle) {
        channelSettle.setUpdateTime(DateUtil.getNow());
        return channelSettleDAO.updateByKey(channelSettle);
    }

    @Override
    public Integer insert(ChannelSettle channelSettle) {
        channelSettle.setCreateTime(DateUtil.getNow());
        channelSettle.setUpdateTime(DateUtil.getNow());
        return channelSettleDAO.insert(channelSettle);
    }

    @Override
    public Integer deleteByKey(Integer relateId) {
        return channelSettleDAO.deleteByKey(relateId);
    }
}